package com.ucl.web.controller.flowsearch;

import com.baomidou.mybatisplus.plugins.Page;
import com.ucl.model.common.ApiResult;
import com.ucl.model.request.flowsearch.SimQueryPara;
import com.ucl.model.vo.flowsearch.SimVO;
import com.ucl.service.flowsearch.SimService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/flowsearch/sim")
public class SimController {

    @Autowired
    private SimService simService;
    /**
     * 列出sim产品信息
     * @return
     */
    @RequestMapping("listPage")
    public ApiResult list(@RequestBody SimQueryPara filter) {
        Page<SimVO> page = new Page<>(filter.getPage(), filter.getLimit());
        simService.listPage(page, filter);
        return ApiResult.ok("获取系统管理-用户基础信息表列表分页成功", page);
    }

    @RequestMapping("getList")
    public ApiResult selectList(@RequestBody SimQueryPara filter) {
        List<SimVO> voList = simService.getList(filter);
        return ApiResult.ok("获取列表成功", voList);
    }

    /**
     * 获取所有的sim产品所在国家列表
     *
     * @return
     */
    @RequestMapping("countryList")
    public ApiResult countyrList() {
        return simService.queryCountryList();
    }

    /**
     * 获取所有的sim产品供应商列表
     *
     * @return
     */
    @RequestMapping("supplierList")
    public ApiResult supplierList() {
        return simService.querySupplierList();
    }

    /**
     * 获取所有的sim产品适用地区列表
     *
     * @return
     */
    @RequestMapping("regionList")
    public ApiResult regionList() {
        return simService.queryRegionList();
    }

    /**
     * 获取所有的sim产品合约期列表
     *
     * @return
     */
    @RequestMapping("periodList")
    public ApiResult periodList() {
        return simService.queryPeriodList();
    }

    /**
     * 更新sim产品信息
     *
     * @return
     */
    @RequestMapping("updateSimInfo")
    public ApiResult updateSimInfo(@RequestBody SimVO simVO) {
        return simService.updateFlowInfo(simVO);
    }

    /**
     * 删除sim产品信息
     *
     * @return
     */
    @RequestMapping("deleteSimInfo")
    public ApiResult deleteSimInfo(@RequestBody SimVO simVO) {
        return simService.deleteFlowInfo(simVO);
    }
}
